<template>
  <div>
    <h6>
      {{ msg }} ---- {{ age }}
    </h6>
    <el-button @click="changeMsg">
      修改msg
    </el-button>

    <el-button @click="changeAge">
      修改age
    </el-button>
  </div>
</template>

<script>
// v-model传递过来的属性如何在子组件修改他
// input  $emit('input')
export default {
  props: {
    msg: String,
    age: Number
  },
  mounted() {
    console.log(this.$listeners)
  },
  methods: {
    changeMsg() {
      // 解决了什么问题
      this.$emit('update:msg', '传智')
    },
    changeAge() {
      this.$emit('update:age', 20)
    }
  }
}
</script>

<style scoped>

</style>
